package com.mlxg.config.oss;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
 * @author cy zhang
 * @version 1.0
 * @date 2025/4/18 14:33
 */
@Configuration
public class OssClientConfig {

    @Autowired
    private ExhibitorAppConfig exhibitorAppConfig;

    @Bean
    public OSS createOSS(){
        // 获取OSS配置
        String endpoint =exhibitorAppConfig.getAliyunOss().getEndpoint();
        String bucketName = exhibitorAppConfig.getAliyunOss().getBucketName();
        String accessKeyId = exhibitorAppConfig.getAliyunOss().getAccessKeyId();
        String accessKeySecret =exhibitorAppConfig.getAliyunOss().getAccessKeySecret();
        OSS  ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
        return ossClient;
    }
}
